﻿
//删除数据需要同步删除相同的DescriptionOfSuppliesServices的数据.
function removeData(grid) {
    var store = grid.getStore();
    var items = [];

    var editor = grid.getColumns()[0].getEditor(),
        r = editor.getStore().findRecord('code', e.data.DescriptionOfSuppliesServices);

    editor.getStore().remove(r);

    if (store.data.items.length > 0) {
        for (var x = 0; x < store.data.items.length; x++) {
            var item = store.data.items[x];
            if (item.get('DescriptionOfSuppliesServices') == e.data.DescriptionOfSuppliesServices) {
                items[item.get('id')] = item;
            }
        }
        for (var key in items) {
            store.remove(items[key]);
        }
    }
}

removeData(ref.datagrid3);
removeData(ref.datagrid4);
removeData(ref.datagrid5);
removeData(ref.datagrid6);
